
#ifndef _ITEMSELECTOR_H       // Prevent multiple definitions if this 
#define _ITEMSELECTOR_H       // file is included in more than one place
#define WIN32_LEAN_AND_MEAN

#include "button.h"
#include "constants.h"

/*

Item selector positions:

4 2 5
0   1
6 3 7

*/

namespace itemSelectorNS
{
	const int SPACING = 55;                            
}

class ItemSelector
{
public:
	ItemSelector();

	virtual ~ItemSelector();

	void Initialize(Graphics *graphics, Input *i, Audio *audio);

	void draw();

	void addItem(int item);

	void removeItem(int pos);

	virtual void update(float frameTime);

	virtual int getSelectedItem() {return selectedItem;}

	virtual void activate();

	virtual void deactivate();

	virtual bool isActivated() {return activated;}
	

	// Set methods
	void setSlots(int n) {slots = n;}

	void setCenterX(float x) {centerX = x;updateImageOverlaysPositions();}
	
	void setCenterY(float y) {centerY = y;updateImageOverlaysPositions();}

	// TODO: ADD onLostDevice
	float getAngle() {return angle;}


protected:
	Graphics *graphics;
	Input *input;
	Audio *audio;
	int items[8];	// Item list
	int slots;
	int selectedItem;
	bool activated;
	int hovered[8]; 
	float angle;
	float centerX;
	float centerY;

	TextureManager	textureManagers[8];
	Image			imageOverlays[8];
	void updateImageOverlaysPositions();

	TextureManager buttonTexture;
	Image button;
	//Image imageOverlays[8];
	
	TextureManager textureManager;
	
	// Protectd functions
	const char *itemNToFileName(int itemN);

	

	void draw8();

	void update8();

};

#endif